<template>
  <van-cell-group title="整改跟踪" class="panel-history-process">
    <van-empty v-if="historys.length === 0" description="无整改历史信息" />
    <van-steps direction="vertical" :active="0">
      <van-step
        v-for="(history) in historys"
        :key="history.id">
        <van-row>
          <span>整改操作：</span>{{ history.op_event == "Import" ? '导入数据' : dictRctifyOperate(history.op_event)}}
        </van-row>
        <van-row>
          <span>操作人员：</span>{{history.op_username}}
        </van-row>
        <van-row>
          <span>操作时间：</span>{{history.op_datetime}}
        </van-row>
        <van-row>
          <span>操作内容：</span>{{history.op_content}}
        </van-row>
        <van-row>
          <span>指定部门：</span>{{history.next_username}}
        </van-row>
      </van-step>
    </van-steps>
  </van-cell-group>
</template>

<script>
import { getRectifyHistory } from '@/api/rectify'
import DictMixin from '@/mixins/DictMixin'
export default {
  name: 'PanelHistoryProcess',
  props: ['rectify'],
  mixins: [DictMixin],
  data () {
    return {
      historys: []
    }
  },
  mounted () {
    getRectifyHistory(this.rectify.id).then(res => {
      let { data } = res
      console.log(data)
      if (data[this.$response.CODE] === this.$response.SUCCESS) {
        this.historys = data[this.$response.DATA]
      } else {
        this.$toast.fail('更新整改信息失败：' + data[this.$response.MESSAGE])
      }
    }, errFunc => {
      this.$notify('服务调用失败：' + errFunc.toString())
      console.log(errFunc.toString())
    })
  }
}
</script>

<style scoped lang="less">

</style>
